home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
crwdemo
/
export.frm
< prev
next >
Wrap
Text File
|
1994-11-01
|
6KB
|
202 lines
VERSION 2.00
Begin Form Form1
Caption = "Form1"
ClientHeight = 2715
ClientLeft = 1020
ClientTop = 1425
ClientWidth = 5640
Height = 3120
Left = 960
LinkTopic = "Form1"
ScaleHeight = 2715
ScaleWidth = 5640
Top = 1080
Width = 5760
Begin CommandButton Command5
Caption = "Start"
Height = 495
Left = 4200
TabIndex = 4
Top = 120
Width = 1215
End
Begin CommandButton Command4
Caption = "Export To"
Height = 495
Left = 2160
TabIndex = 3
Top = 720
Width = 1815
End
Begin CommandButton Command3
Caption = "Get Export Options"
Height = 495
Left = 2160
TabIndex = 2
Top = 120
Width = 1815
End
Begin CommandButton Command2
Caption = "Close Job"
Height = 495
Left = 120
TabIndex = 1
Top = 720
Width = 1215
End
Begin CommonDialog CMDialog1
DialogTitle = "Open Report"
Filter = "Crystal Reports|*.rpt"
Flags = 4096
Left = 1440
Top = 120
End
Begin CommandButton Command1
Caption = "Open Job"
Height = 495
Left = 120
TabIndex = 0
Top = 120
Width = 1215
End
Begin Label Label1
Caption = "To use this app: 1) open a job 2a) choose Get Export Options && Export To or 2b) just choose Export To 3) Start the job"
Height = 1215
Left = 120
TabIndex = 5
Top = 1320
Width = 5295
WordWrap = -1 'True
End
End
Dim OpenResult As Integer
Dim JobHandle As Integer
Dim ExportOptions As PEExportOptions
Dim ExportOptionsValid As Integer
Sub Command1_Click ()
If JobHandle <> 0 Then
MsgBox "Job already open"
Exit Sub
End If
CMDialog1.Action = 1
If CMDialog1.Filename <> "" Then
JobHandle = PEOpenPrintJob(CMDialog1.Filename)
If JobHandle = 0 Then
MsgBox "Can't open job - error " & PEGetErrorCode(0)
End If
End If
End Sub
Sub Command2_Click ()
If JobHandle = 0 Then
MsgBox "Job not open"
Exit Sub
End If
PEClosePrintJob (JobHandle)
JobHandle = 0
Call InitExportOptions
End Sub
Sub Command3_Click ()
If JobHandle = 0 Then
MsgBox "Job not open"
Exit Sub
End If
If ExportOptionsValid = 0 Then
Call InitExportOptions
End If
' PEGetExportOptions gets complete information about format and
' destination for the export
' The ExportOptions must be passed to PEExportTo before calling PEStartPrintJob
ExportOptionsValid = PEGetExportOptions(JobHandle, ExportOptions)
End Sub
Sub Command4_Click ()
If JobHandle = 0 Then
MsgBox "Job not open"
Exit Sub
End If
If ExportOptionsValid = 0 Then
Call InitExportOptions
End If
' Whenever you call PEExportTo, you must ensure that the format
' and dll names have been filled in
' You can do this by assigning specific names (as InitExportOptions does)
' or by calling PEGetExportOptions
' If the ExportOptions structure doesn't contain all information needed
' by a format or destination dll, it will ask for the information
' when you call PEStartPrintJob
' An ExportOptions structure filled in by PEGetExportOptions always has
' all the information needed by both dll's
ExportOptionsValid = PEExportTo(JobHandle, ExportOptions)
If ExportOptionsValid = 0 Then
MsgBox "PEExportTo failed - error code: " & PEGetErrorCode(JobHandle)
End If
End Sub
Sub Command5_Click ()
If JobHandle = 0 Then
MsgBox "Job not open"
Exit Sub
End If
If ExportOptionsValid = 0 Then
MsgBox "Cannot print - no export options"
Exit Sub
End If
Dim success As Integer
success = PEStartPrintJob(JobHandle, 1)
If success <> 1 Then
MsgBox "Exporting failed - error code: " & PEGetErrorCode(JobHandle)
End If
End Sub
Sub Form_Load ()
JobHandle = 0
Call InitExportOptions
OpenResult = PEOpenEngine()
If OpenResult = 0 Then
MsgBox "PEOpenEngine returned " & OpenResult & " - error code " & PEGetErrorCode(0)
End If
End Sub
Sub Form_Unload (Cancel As Integer)
If OpenResult <> 0 Then
Call PECloseEngine
End If
JobHandle = 0
End Sub
Sub InitExportOptions ()
ExportOptions.StructSize = Len(ExportOptions)
ExportOptions.FormatDLLName = "uxftext" + Chr$(0)
ExportOptions.FormatType = 0
ExportOptions.FormatOptions = 0
ExportOptions.DestinationDLLName = "uxddisk" + Chr$(0)
ExportOptions.DestinationType = 0
ExportOptions.DestinationOptions = 0
ExportOptions.NFormatOptionsBytes = 0
ExportOptions.NDestinationOptionsBytes = 0
ExportOptionsValid = 0
End Sub